<%@ page language="java" import="java.util.*,com.bgt.*"
	pageEncoding="UTF-8"%>
<%@ include file="/page/comm/comm.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div id="p2" class="easyui-panel" title="添加用户2"
		style="width: 500px; height: 150px; padding: 10px; background: #fafafa;"
		data-options="iconCls:'icon-save',closable:true">
		<%--,collapsible:true,minimizable:true,maximizable:true  祛除折叠 最小最大化--%>
		 <div id="adduser2" title="添加用户2" style="width:400px;height:200px;">
		 	<form id="addusers2" method="post">
			 <table>
			 	<tr>
			 	<td>用户名：</td>
			 	<td><input type="text" name="usertem.userName" class="easyui-validatebox" data-options="required:true,validType:'bgt'" /></td>
			 	</tr>
			 	<tr>
			 	<td>密码：</td>
			 	<td><input type="password" name="usertem.passWord" /></td>
			 	</tr>
			 	<tr>
			 		<td>
			 		<input type="button" value="提交" onclick="add2()"/>
			 		</td>
			 	</tr>
			 </table>
			 </form>
			 </div>

	</div>
<script type="text/javascript">
$.extend($.fn.validatebox.defaults.rules, {
    equals: {
        validator: function(value,param){
            return value == $(param[0]).val();
        },
        message: 'Field do not match.'
    }
});
$.extend($.fn.validatebox.defaults.rules, {
    bgt: {
        validator: function(value,param){
            return  value.length>2;
        },
        message: '长度要大于2.'
    }
});
	function add(){
		$.ajax({
			url:"mUserAction!addUser.do",
			data:$("#addusers").serialize(),
			type:"post",
			dataType: 'json',
			success:function(data){
				console.info(data);
				if(data.dataMap.success){
					$.messager.alert("提示",data.dataMap.msg);
				}else{
					$.messager.alert("提示",data.dataMap.msg);
				}
			}
		});
	}
	function add2(){
		$('#addusers2').submit();
	}
	$('#addusers2').form({
	    url:'mUserAction!addUser.do',
	    success:function(data){
	    	var data=$.parseJSON(data);
	    	console.info(data)
	    	$.messager.alert("提示",data.dataMap.msg)
	    }
	});
</script>
</body>
</html>